package com.liangweicheng.website.controller;

import com.liangweicheng.website.domain.Test;
import com.liangweicheng.website.service.TestService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TestController {

    @Value("${test.hello:Liangweicheng}")
    private String testHello;

    @Resource
    private TestService testService;

    @GetMapping("/hello/get")
    public String helloGet() {
        return "Hello Get 梁炜城！" + testHello;
    }

    @PostMapping("/hello/post")
    public String helloPost(String name) {
        return "Hello Post " + name;
    }

    @GetMapping("/test/list")
    public List<Test> list(){
        return testService.list();
    }
}
